const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
  entry: './index.js',
  output: {
    filename: '[hash][name].js',
    path: path.resolve(__dirname, 'dist'),
    chunkFilename: '[chunkhash].js'
  },
  plugins: [
    new HtmlWebpackPlugin({
      title: '算法',
      filename: 'index.html',
      template: 'index.html',
      path: path.resolve(__dirname, 'dist'),
    }),
    new webpack.HotModuleReplacementPlugin()
  ],
  devServer: {
    contentBase: path.join(__dirname, "dist"),
    compress: true,
    port: 9888,
    hot: true
  },
}